<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="Chinese">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="简介在UWP开发中，可以使用Toast方式直接生成系统通知，并出现在Windows的通知中心中。 Toast通知的核心是一个XML文档，其中包含了通知的图标、文字和式样。系统中提供了该XML文档的模板。 在这里使用了类似于jQuery的连缀操作的形式使用C#封装了一个关于通知的类，不过还不支持win10可交互通知，以后会加入。 模板类型消息通知的模板一共有8中，这里有每一种模板的介绍。 ////">
<meta name="keywords" content="C#,UWP,Toast,通知">
<meta property="og:type" content="article">
<meta property="og:title" content="使用C#封装一个UWP的Toast通知类">
<meta property="og:url" content="http://blog.zhengzi.me/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-e7-9a-84toast-e9-80-9a-e7-9f-a5-e7-b1-bb/index.html">
<meta property="og:site_name" content="政子的博客">
<meta property="og:description" content="简介在UWP开发中，可以使用Toast方式直接生成系统通知，并出现在Windows的通知中心中。 Toast通知的核心是一个XML文档，其中包含了通知的图标、文字和式样。系统中提供了该XML文档的模板。 在这里使用了类似于jQuery的连缀操作的形式使用C#封装了一个关于通知的类，不过还不支持win10可交互通知，以后会加入。 模板类型消息通知的模板一共有8中，这里有每一种模板的介绍。 ////">
<meta property="og:locale" content="Chinese">
<meta property="og:updated_time" content="2018-08-21T09:49:42.773Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="使用C#封装一个UWP的Toast通知类">
<meta name="twitter:description" content="简介在UWP开发中，可以使用Toast方式直接生成系统通知，并出现在Windows的通知中心中。 Toast通知的核心是一个XML文档，其中包含了通知的图标、文字和式样。系统中提供了该XML文档的模板。 在这里使用了类似于jQuery的连缀操作的形式使用C#封装了一个关于通知的类，不过还不支持win10可交互通知，以后会加入。 模板类型消息通知的模板一共有8中，这里有每一种模板的介绍。 ////">






  <link rel="canonical" href="http://blog.zhengzi.me/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-e7-9a-84toast-e9-80-9a-e7-9f-a5-e7-b1-bb/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>使用C#封装一个UWP的Toast通知类 | 政子的博客</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="Chinese">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">政子的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">强迫症|学习者|伪文青</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />Home</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />About</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />Tags</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />Archives</a>
  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.zhengzi.me/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-e7-9a-84toast-e9-80-9a-e7-9f-a5-e7-b1-bb/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jason Bian">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="政子的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">使用C#封装一个UWP的Toast通知类
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              

              
                
              

              <time title="Created: 2016-09-25 16:14:38" itemprop="dateCreated datePublished" datetime="2016-09-25T16:14:38+08:00">2016-09-25</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">Edited on</span>
                
                <time title="Modified: 2018-08-21 17:49:42" itemprop="dateModified" datetime="2018-08-21T17:49:42+08:00">2018-08-21</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/C/" itemprop="url" rel="index"><span itemprop="name">C#</span></a></span>

                
                
                  , 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/C/UWP/" itemprop="url" rel="index"><span itemprop="name">UWP</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>在UWP开发中，可以使用Toast方式直接生成系统通知，并出现在Windows的通知中心中。 Toast通知的核心是一个XML文档，其中包含了通知的图标、文字和式样。系统中提供了该XML文档的模板。 在这里使用了类似于jQuery的连缀操作的形式使用C#封装了一个关于通知的类，不过还不支持win10可交互通知，以后会加入。</p>
<h2 id="模板类型"><a href="#模板类型" class="headerlink" title="模板类型"></a>模板类型</h2><p>消息通知的模板一共有8中，这里有每一种模板的介绍。</p>
<p>//<br>// Summary:<br>//     指定要在消息通知中使用的模版。<br>[ContractVersion(typeof(UniversalApiContract), 65536)]<br>public enum ToastTemplateType<br>{<br>  //<br>  // Summary:<br>  //     在三行文本中被包装的大型图像和单个字符串。<br>  ToastImageAndText01 = 0,<br>  //<br>  // Summary:<br>  //     大图像、加粗文本的一个字符串在第一行、常规文本的一个字符串包装在第二、三行中。<br>  ToastImageAndText02 = 1,<br>  //<br>  // Summary:<br>  //     大图像、加粗文本的一个字符串被包装在开头两行中、常规文本的一个字符串包装在第三行中。<br>  ToastImageAndText03 = 2,<br>  //<br>  // Summary:<br>  //     大图像、加粗文本的一个字符串在第一行、常规文本的一个字符串在第二行中、常规文本的一个字符串在第三行中。<br>  ToastImageAndText04 = 3,<br>  //<br>  // Summary:<br>  //     包装在三行文本中的单个字符串。<br>  ToastText01 = 4,<br>  //<br>  // Summary:<br>  //     第一行中加粗文本的一个字符串、覆盖第二行和第三行的常规文本的一个字符串。<br>  ToastText02 = 5,<br>  //<br>  // Summary:<br>  //     覆盖第一行和第二行的加粗文本的一个字符串。第三行中常规文本的一个字符串。<br>  ToastText03 = 6,<br>  //<br>  // Summary:<br>  //     第一行中加粗文本的一个字符串、第二行中常规文本的一个字符串、第三行中常规文本的一个字符串。<br>  ToastText04 = 7<br>}</p>
<p>以下是每一种通知的XML模板内容</p>
<p>//类型0</p>
<toast><br>    <visual><br>        <binding template="ToastImageAndText01"><br>            <image id="1" src=""><br>            <text id="1"></text><br>        </image></binding><br>    </visual><br></toast><br>//类型1<br><toast><br>    <visual><br>        <binding template="ToastImageAndText02"><br>            <image id="1" src=""><br>            <text id="1"></text><br>            <text id="2"></text><br>        </image></binding><br>    </visual><br></toast><br>//类型2<br><toast><br>    <visual><br>        <binding template="ToastImageAndText03"><br>            <image id="1" src=""><br>            <text id="1"></text><br>            <text id="2"></text><br>        </image></binding><br>    </visual><br></toast><br>//类型3<br><toast><br>    <visual><br>        <binding template="ToastImageAndText04"><br>            <image id="1" src=""><br>            <text id="1"></text><br>            <text id="2"></text><br>            <text id="3"></text><br>        </image></binding><br>    </visual><br></toast><br>//类型4<br><toast><br>    <visual><br>        <binding template="ToastText01"><br>            <text id="1"></text><br>        </binding><br>    </visual><br></toast><br>//类型5<br><toast><br>    <visual><br>        <binding template="ToastText02"><br>            <text id="1"></text><br>            <text id="2"></text><br>        </binding><br>    </visual><br></toast><br>//类型6<br><toast><br>    <visual><br>        <binding template="ToastText03"><br>            <text id="1"></text><br>            <text id="2"></text><br>        </binding><br>    </visual><br></toast><br>//类型7<br><toast><br>    <visual><br>        <binding template="ToastText04"><br>            <text id="1"></text><br>            <text id="2"></text><br>            <text id="3"></text><br>        </binding><br>    </visual><br></toast>

<h2 id="代码实现"><a href="#代码实现" class="headerlink" title="代码实现"></a>代码实现</h2><p>using System;<br>using System.Collections.Generic;<br>using Windows.Data.Xml.Dom;<br>using Windows.UI.Notifications;</p>
<p>class ToastLib {</p>
<pre><code>//定义通知模板和XML节点
private ToastTemplateType toastTemplate;
private XmlDocument toastXml;
private IXmlNode toastNode;
private XmlNodeList toastTextElements;
private XmlNodeList toastImageAttributes;

//消息类型
private int toastType;
private int ToastType {
    set {
        if (value &gt;= 0 &amp;&amp; value &lt;= 7) {
            toastType = value;
        } else {
            throw new ArgumentOutOfRangeException();
        }
    }
    get {
        return toastType;
    }
}

//构造函数，传入通知模板种类即可
public ToastLib(int type = 0) {
    ToastType = type;
    toastTemplate = (ToastTemplateType)ToastType;
    toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
    toastTextElements = toastXml.GetElementsByTagName(&quot;text&quot;);
    toastImageAttributes = toastXml.GetElementsByTagName(&quot;image&quot;);
}

//生成通知XML的关键函数，用于传入通知图片的连接和通知文字的内容
//传入字符串sample &quot;消息内容&quot; or $&quot;ms-appx:///assets/图片文件名&quot;
public ToastLib makeToast(List&lt;string&gt; toastPara) {
    int\[\] toastParaNumArr = { 2, 3, 3, 4, 1, 2, 2, 3 };
    if (toastPara.Count == toastParaNumArr\[ToastType\]) {
        switch (ToastType) {
            case 0:
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[0\]));
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;src&quot;, toastPara\[1\]);
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;alt&quot;, &quot;logo&quot;);
                break;
            case 1:
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;src&quot;, toastPara\[0\]);
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;alt&quot;, &quot;logo&quot;);
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[1\]));
                toastTextElements\[1\].AppendChild(toastXml.CreateTextNode(toastPara\[2\]));
                break;
            case 2:
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;src&quot;, toastPara\[0\]);
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;alt&quot;, &quot;logo&quot;);
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[1\]));
                toastTextElements\[1\].AppendChild(toastXml.CreateTextNode(toastPara\[2\]));
                break;
            case 3:
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;src&quot;, toastPara\[0\]);
                ((XmlElement)toastImageAttributes\[0\]).SetAttribute(&quot;alt&quot;, &quot;logo&quot;);
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[1\]));
                toastTextElements\[1\].AppendChild(toastXml.CreateTextNode(toastPara\[2\]));
                toastTextElements\[2\].AppendChild(toastXml.CreateTextNode(toastPara\[3\]));
                break;
            case 4:
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[0\]));
                break;
            case 5:
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[0\]));
                toastTextElements\[1\].AppendChild(toastXml.CreateTextNode(toastPara\[1\]));
                break;
            case 6:
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[0\]));
                toastTextElements\[1\].AppendChild(toastXml.CreateTextNode(toastPara\[1\]));
                break;
            case 7:
                toastTextElements\[0\].AppendChild(toastXml.CreateTextNode(toastPara\[0\]));
                toastTextElements\[1\].AppendChild(toastXml.CreateTextNode(toastPara\[1\]));
                toastTextElements\[2\].AppendChild(toastXml.CreateTextNode(toastPara\[2\]));
                break;
        }
    } else {
        throw new ArgumentException();
    }
    return this;
}

//加入点按通知进入App以后向App传入的参数
//para example &quot;{\\&quot;type\\&quot;:\\&quot;toast\\&quot;,\\&quot;param1\\&quot;:\\&quot;12345\\&quot;,\\&quot;param2\\&quot;:\\&quot;67890\\&quot;}&quot;
public ToastLib addToastLaunchPara(string launchPara) {
    ((XmlElement)toastNode).SetAttribute(&quot;launch&quot;, launchPara);
    return this;
}

//改变通知的声音
//the avaliable tones are here:Default,IM,Mail,Reminder,SMS,Looping.Alarm,Looping.Alarm2,Looping.Alarm3,Looping.Alarm4,Looping.Alarm5,Looping.Alarm6,Looping.Alarm7,Looping.Alarm8,Looping.Alarm9,Looping.Alarm10,Looping.Call,Looping.Call2,Looping.Call3,Looping.Call4,Looping.Call5,Looping.Call6,Looping.Call7,Looping.Call8,Looping.Call9,Looping.Call10
public ToastLib setToastTone(string tone) {
    XmlElement audio = toastXml.CreateElement(&quot;audio&quot;);
    audio.SetAttribute(&quot;src&quot;, $&quot;ms-winsoundevent:Notification.&quot; + tone);
    toastNode.AppendChild(audio);
    return this;
}

//改变通知的时长
//only 2 types of paras short or long
public ToastLib setToastDuringTime(string duringTime) {
    ((XmlElement)toastNode).SetAttribute(&quot;duration&quot;, duringTime);
    return this;
}

//显示通知
public void showToast() {
    ToastNotification toast = new ToastNotification(toastXml);
    ToastNotificationManager.CreateToastNotifier().Show(toast);
}
</code></pre><p>}</p>
<h2 id="使用方式"><a href="#使用方式" class="headerlink" title="使用方式"></a>使用方式</h2><p>使用方式非常简单，类似于jQuery的连缀操作，可以有选择地对通知进行定制。</p>
<p>public void toastInfo(string info) {<br>    //默认使用第0个模板，如果构造时候传入其他参数则可以使用其他模板<br>    ToastLib toastLib = new ToastLib();<br>    //需要将要传入makeToast的字符串写入一个List中<br>    List<string> toastStrs = new List<string>();<br>    toastStrs.Add(info);<br>    toastStrs.Add(“there’s no logo :(“);<br>    //最简单的toast，其余参数均使用默认<br>    toastLib.makeToast(toastStrs).showToast();<br>    //使用连缀操作进行toast定制化设置，最终调用showToast()进行展示，具体参数可以参考对于每一个函数的注释<br>    toastLib.makeToast(toastStrs).setToastTone(“IM”).setToastDuringTime(“long”).showToast();<br>}</string></string></p>
<h2 id="获取文中代码"><a href="#获取文中代码" class="headerlink" title="获取文中代码"></a>获取文中代码</h2><p>在GitHub的HelloBUPT项目中可以得到代码：<a href="https://github.com/imaginezz/helloBUPT/blob/master/beiyou/CommonLibrary/ToastLib.cs" target="_blank" rel="noopener">https://github.com/imaginezz/helloBUPT/blob/master/beiyou/CommonLibrary/ToastLib.cs</a></p>
<h2 id="参考链接"><a href="#参考链接" class="headerlink" title="参考链接"></a>参考链接</h2><p>Windows 10 UWP开发：如何弹出消息通知：<a href="http://edi.wang/post/2015/11/8/uwp-toast-notification?utm_source=tuicool&amp;utm_medium=referral" target="_blank" rel="noopener">http://edi.wang/post/2015/11/8/uwp-toast-notification?utm_source=tuicool&amp;utm_medium=referral</a></p>
<p>自适应和交互式 Toast 通知：<a href="https://msdn.microsoft.com/zh-cn/windows/uwp/controls-and-patterns/tiles-and-notifications-adaptive-interactive-toasts" target="_blank" rel="noopener">https://msdn.microsoft.com/zh-cn/windows/uwp/controls-and-patterns/tiles-and-notifications-adaptive-interactive-toasts</a></p>
<p>使用Nuget包发送本地通知：<a href="https://msdn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-sending-a-local-tile-notification" target="_blank" rel="noopener">https://msdn.microsoft.com/windows/uwp/controls-and-patterns/tiles-and-notifications-sending-a-local-tile-notification</a></p>
<p>ToastNotification Class：<a href="https://msdn.microsoft.com/zh-cn/library/windows/apps/windows.ui.notifications.toastnotification.aspx" target="_blank" rel="noopener">https://msdn.microsoft.com/zh-cn/library/windows/apps/windows.ui.notifications.toastnotification.aspx</a></p>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/C/" rel="tag"># C#</a>
          
            <a href="/tags/UWP/" rel="tag"># UWP</a>
          
            <a href="/tags/Toast/" rel="tag"># Toast</a>
          
            <a href="/tags/通知/" rel="tag"># 通知</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2016/09/22/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-e7-9a-84http-get-e5-92-8cpost-e7-9a-84-e7-b1-bb/" rel="next" title="使用C#封装一个UWP的HTTP Get和Post的类">
                <i class="fa fa-chevron-left"></i> 使用C#封装一个UWP的HTTP Get和Post的类
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2016/09/25/e4-bd-bf-e7-94-a8c-e5-b0-81-e8-a3-85-e4-b8-80-e4-b8-aauwp-applicaion-data-e7-9a-84-e7-bb-93-e6-9e-84-e5-8c-96-e5-ad-98-e5-82-a8-e7-b1-bb/" rel="prev" title="使用C#封装一个UWP Applicaion Data的结构化存储类">
                使用C#封装一个UWP Applicaion Data的结构化存储类 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="Jason Bian" />
            
              <p class="site-author-name" itemprop="name">Jason Bian</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">86</span>
                    <span class="site-state-item-name">posts</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">41</span>
                    <span class="site-state-item-name">categories</span>
                  
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">109</span>
                    <span class="site-state-item-name">tags</span>
                  
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#简介"><span class="nav-number">1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#模板类型"><span class="nav-number">2.</span> <span class="nav-text">模板类型</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#代码实现"><span class="nav-number">3.</span> <span class="nav-text">代码实现</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使用方式"><span class="nav-number">4.</span> <span class="nav-text">使用方式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#获取文中代码"><span class="nav-number">5.</span> <span class="nav-text">获取文中代码</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#参考链接"><span class="nav-number">6.</span> <span class="nav-text">参考链接</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Jason Bian</span>

  

  
</div>




  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Gemini</a></div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.4.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
